﻿using Application.Dto;
using Application.IAppSrevices;
using AutoMapper;
using Domain.Entitys;
using Domain.Repositorys;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Application.AppSrevices
{
	public class EIService:IEIService
	{
		private readonly IMapper mapper;
		private readonly IEIRepositoy eIRepositoy;

		public EIService(IMapper mapper,IEIRepositoy eIRepositoy)
		{
			this.mapper = mapper;
			this.eIRepositoy = eIRepositoy;
		}

		public async Task<int> EIAdd(EI eI)
		{
			return await eIRepositoy.EIAdd(eI);
		}

		public async Task<List<EI>> EISelectID(string name)
		{
			return await eIRepositoy.EISelectID(name);
		}

		public async Task<int> EIUpdate(EIUpdateDto eIUpdateDto)
		{
			EI ei = mapper.Map<EI>(eIUpdateDto);
			return await eIRepositoy.EIUpdate(ei);
		}

		public async Task<int> EIUpdateSX(EIUpdateSXDto eIUpdateSXDto)
		{
			EI ei = mapper.Map<EI>(eIUpdateSXDto);
			return await eIRepositoy.EIUpdateSX(ei);
		}
	}
}
